import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CustomerProviderChannelVO, CustomerProviderChannelForm, CustomerProviderChannelQuery } from '@/api/customer/customerProviderChannel/types';

/**
 * 查询客户供应商通道绑定列表
 * @param query
 * @returns {*}
 */

export const listCustomerProviderChannel = (query?: CustomerProviderChannelQuery): AxiosPromise<CustomerProviderChannelVO[]> => {
  return request({
    url: '/customer/customerProviderChannel/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询客户供应商通道绑定详细
 * @param id
 */
export const getCustomerProviderChannel = (id: string | number): AxiosPromise<CustomerProviderChannelVO> => {
  return request({
    url: '/customer/customerProviderChannel/' + id,
    method: 'get'
  });
};

/**
 * 新增客户供应商通道绑定
 * @param data
 */
export const addCustomerProviderChannel = (data: CustomerProviderChannelForm) => {
  return request({
    url: '/customer/customerProviderChannel',
    method: 'post',
    data: data
  });
};

/**
 * 修改客户供应商通道绑定
 * @param data
 */
export const updateCustomerProviderChannel = (data: CustomerProviderChannelForm) => {
  return request({
    url: '/customer/customerProviderChannel',
    method: 'put',
    data: data
  });
};

/**
 * 删除客户供应商通道绑定
 * @param id
 */
export const delCustomerProviderChannel = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/customerProviderChannel/' + id,
    method: 'delete'
  });
};
